﻿using System.Windows.Controls;
using CI.Organism;

namespace CI.Interfaces
{
    /// <summary>Physical aspects of the hosting environment, eg get/set location bind IO</summary>
    public interface IHostingEnvironmentPhysical
    {
        /// <summary>Gets the location of the Organism in the environment</summary>
        ILocation GetLocation(IOrganism organism);

        /// <summary>Sets the location of the Organism in the environment</summary>
        ILocation SetLocation(IOrganism organism, ILocation location);

        /// <summary>Register the cell in the environment</summary>
        bool RegisterCell(ICell cell, ActionType actionType);

        /// <summary>Checks to see if the Organism is registered in the physical environment</summary>
        bool Registered(IOrganism organism);

        UserControl DisplayControl { get; }

        /// <summary>
        /// Bind a name of a IO Event in the physical world to a synapse
        /// eg "Left Bumper" to a IO synapse, "Right Drive" to a IO synapse
        /// </summary>
        /// <param name="organism">Organism its being bound to</param>
        void BindSynapseIO(IOrganism organism);

        /// <summary>
        /// UnBind a name of a IO Event in the physical world to a synapse
        /// eg "Left Bumper" to a IO synapse, "Right Drive" to a IO synapse
        /// </summary>
        /// <param name="organism">Organism its being unbound from</param>
        void UnBindSynapseIO(IOrganism organism);

        /// <summary>
        /// Clean up the environment in case of restart
        /// </summary>
        void CleanUp();

        /// <summary>
        /// Wait for either the simulation,physics etc engine to catch up, eg fps to an acceptable value, idel state
        /// </summary>
        void WaitForIdle();

        /// <summary>
        /// Shutdown the robotics service and related services
        /// </summary>
        void ShutDownService();

        /// <summary>
        /// Check internal state of environment etc, make sure entity counts etc are all equal
        /// </summary>
        void SanityCheck();

        /// <summary>
        /// Break out of the hosting environment, usually call when shutting down
        /// </summary>
        void Break();

        /// <summary>
        /// Max entitys supported by environment
        /// </summary>
        int MaxEntitysSupported { get; }

        /// <summary>
        /// Entitys consumed
        /// </summary>
        int EntitysConsumed { get; }

        /// <summary>
        /// Hide the external camera window if it supports it
        /// </summary>
        void HideExternalCameraWindow(bool hide);

    }
}